home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 840 b | 55 lines | [TEXT/CWIE] |
- // Context.h
-
- #ifndef Context_h
- #define Context_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
-
- class Context
- {
- friend class ContextUser;
-
- private:
- Context *const parent;
- uint32 users;
- bool active;
-
- static Context *current;
-
- void Activate();
- void Deactivate();
-
- void ReenterWithParents();
-
- // not implemented:
- Context( const Context& );
- void operator=( const Context& );
-
- protected:
- virtual void Enter() = 0;
- virtual void Leave() = 0;
- virtual void Check() = 0;
- virtual void Reenter() { Enter(); }
-
- public:
- Context();
- ~Context();
-
- void BeCurrent();
- void BeActive();
- void BeInactive();
-
- static void LeaveAll();
-
- static void CheckActive();
- static void ReenterActive();
-
- static void Set( Context * );
-
- static Context *Current() { return current; }
- };
-
- #endif
-